package com.touni.utils;

import cn.hutool.bloomfilter.BitMapBloomFilter;
import cn.hutool.bloomfilter.BloomFilterUtil;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.ZipUtil;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName : HuDemo
 * @Description :
 * @Author : lwq
 * @Date: 2020-10-14 10:53
 */
public class HuDemo {
    public static void main(String[] args) {
        BitMapBloomFilter bitMapBloomFilter = new BitMapBloomFilter(10);
        bitMapBloomFilter.add("通知");
        bitMapBloomFilter.add("公告");
        bitMapBloomFilter.add("规则");
        boolean contains = bitMapBloomFilter.contains("这是一个公告通知");
        System.out.println(contains);

        Map<String,String> map = new HashMap<>();

        new Thread(() -> {
            for (int i = 0; i < 1000000; i++) {
                map.put(i+"","ss");
                ThreadUtil.safeSleep(100);
                System.out.println(Thread.currentThread().getId() + "size:" + map.size());
            }
        }).start();
        new Thread(() -> {
            for (int i = 0; i < 1000000; i++) {
                map.put(i+"","ss");
                ThreadUtil.safeSleep(100);
                System.out.println(Thread.currentThread().getId() + "size:" + map.size());
            }
        }).start();
        new Thread(() -> {
            for (int i = 0; i < 1000000; i++) {
                map.put(i+"","ss");
                ThreadUtil.safeSleep(100);
                System.out.println(Thread.currentThread().getId() + "size:" + map.size());
            }
        }).start();
        System.out.println("============================");
        System.out.println(map.size());

    }

}
